import {defHttp} from '/@/utils/http/axios';
import {PageParams} from "/@/api/model/baseModel";


enum Api {
  page = '/blacklist/page',
  get = '/blacklist/get',
  add = '/blacklist/save',
  update = '/blacklist/update',
  setStatus = '/blacklist/setStatus',
  remove = '/blacklist/remove'
}

export const page = (pageParams: PageParams) =>
  defHttp.get({url: Api.page, params: pageParams}, {errorMessageMode: 'none'}).then(data => {
    const newData = {items: data.records, total: Number(data.total)}
    console.info('newData', newData)
    return newData
  });

export const add = (params) =>
  defHttp.post({url: Api.add, params: params}, {errorMessageMode: 'none'});

export const update = (params) =>
  defHttp.post({url: Api.update, params: params}, {errorMessageMode: 'none'});

export const setStatus = (blacklistId: number) =>
  defHttp.post({url: Api.setStatus, params: {blacklistId}});

export const remove = (ids: number) =>
  defHttp.post({url: Api.remove, params: {ids}});
